package com.njlime.sys.repository;

import com.njlime.core.helper.PageBean;
import com.njlime.sys.entities.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * Created by Dean on 2017-7-27.
 */
public interface RoleDao extends JpaRepository<Role, Integer>,JpaSpecificationExecutor<Role> {
    List<Role> listByUserId(Integer userId);
    List<Role> findAllList();
    PageBean list(PageBean pageBean, Role role);
    Role getByName(String name);
    Role getByEnName(String en_name);
    int updateRole(Role role);
    int deleteRole(Integer id);
    void deleteUserRole(Integer id);
    int insertUserRole(Integer role_id, Integer user_id);
    void deleteRoleMenu(Integer id);
    int insertRoleMenu(Integer role_id, Integer menu_id);
    void deleteRoleUnit(Integer id);
    int insertRoleUnit(Integer role_id, Integer unit_id);
    void delUserRoleByUser(Integer user_id);
}
